#include<iostream>
#include<string>
#include<assert.h>
using namespace std;
//void Swap(int& left, int& right)
//{
	//int temp = left;
	//left = right;
	//right = temp;
//}
//void Swap(double& left, double& right)
//{
	//double temp = left;
	//left = right;
	//right = temp;
//}
//void Swap(char& left, char& right)
//{
	//char temp = left;
	//left = right;
	//right = temp;
//}
//template<class K>
//void Swap(K& x, K& y)
//{
	//K tmp = x;
	//x = y;
	//y = tmp;
//}
//template<class K1,class K2>
//void func(const K1& x, const K2& y)
//{

//}
//int main()
//{
	//int a = 1,b = 2;
	//Swap(a, b);
	//double c = 1.1,d = 2.2;
	//Swap(c, d);
	//Swap(a,c);
	//swap(a, b);
	//func(a, c);
	//func(a, b);
	//func(b, d);
	//return 0;
//}
//template<class K>
//K add(const K& x, const K& y)
//{
	//return x + y;
//}
//template<class K1,class K2>
//K1 add(const K1& x, const K2& y)
//{
	//return x + y;
//}
//template<class K>
//K* func(int n)
//{
	//return new K[n];
//}
//int main()
//{
	//int a = 1, b = 2;
	//double c = 1.1, d = 2.2;
	//add(a,b);
	//add(c, d);
	//add(a, c);
	//cout << add(a, (int)c) << endl;
	//cout << add((double)a, c) << endl;
	//cout << add<int>(a, c) << endl;
	//cout << add<double>(a, c) << endl;
	//cout << add(a, c) << endl;
	//double* p1 = func<double>(10);
	//return 0;
//}
//template<class K>
//K add(const K& x, const K& y)
//{
	//return x + y;
//}
//int add(const int& x, const int& y)
//{
	//return (x + y)*10;
//}
//int main()
//{
	//int k1 = 1, k2 = 2;
	//cout << add(k1, k2) << endl;
	//return 0;
//}
//template<class K>
//class Stack
//{
//public:
	//Stack(int n=4)
		//:_arr(new K[n])
		//,_size(0)
		//,_capacity(n)
	//{

	//}
	//~Stack()
	//{
		//delete[] _arr;
	    //_arr = nullptr;
		//_size = _capacity = 0;
	//}
	//void Push(const K& x);
	//{
		//if (_size == _capacity)
		//{
			//K* tmp = new K[_capacity * 2];
			//memcpy(tmp, _arr, _size * sizeof(K));
			//delete[] _arr;
			//_arr = tmp;
			//_capacity *= 2;
		//}
		//_arr[_size++] = x;
	//}
	//void Pop()
	//{
		//--_size;
	//}
//private:
	//K* _arr;
	//size_t _capacity;
	//size_t _size;
//};
//template<class K>
//void Stack<K>::Push(const K& x)
//{
	//if (_size == _capacity)
	//{
		//K* tmp = new K[_capacity * 2];
		//memcpy(tmp, _arr, _size * sizeof(K));
		//delete[] _arr;
		//_arr = tmp;
		//_capacity *= 2;
	//}
	//_arr[_size++] = x;
//}
//int main()
//{
	//Stack<int> st1;
	//st1.Push(1);
	//st1.Push(2);
	//st1.Push(3);
	//Stack<double> st2;
	//st2.Push(1.1);
	//st2.Push(2.2);
	//st2.Push(3.3);
	//Stack<double>* st3 = new Stack<double>;
	//delete st3;
	//return 0;
//}
//int main()
//{
	//string st1;
	//string st2("hello world");
	//string st3(st2);
	//cout << st1 << endl;
	//cout << st2 << endl;
	//cout << st3 << endl;
	//cin >> st1;
	//cout << st1 << endl;
	//string st4(st2, 6, 5);
	//cout << st4 << endl;
	//string st5(st2, 6, 15);
	//cout << st5 << endl;
	//string st6(st2, 6);
	//cout << st6 << endl;
	//string st7("hello world", 5);
	//cout << st7 << endl;
	//string st8(10, 'x');
	//cout << st8 << endl;
	//return 0;
//}
class string1
{
public:
	char& operator[](size_t i)
	{
		assert(i < _size);
		return _str[i];
	}
private:
	char* _str;
	size_t _size;
	size_t _capacity;
};
int main()
{
	string st1("hello world");
	st1[0] = 'x';
	string st2(10, 'x');
	st2[10] = 'y';
	cout << st1 << endl;
	cout << st2 << endl;
	return 0;
}